﻿using Device.Domain;
using Device.Infrstructre.Interface;
using Device.Read.API.Applcation.Command.EquipmentCommand;
using MediatR;

namespace Device.Read.API.Applcation.CommandHandlers.EquipmentCommandHandlers
{
    public class FillEquipmentCommandHandlers:IRequestHandler<FillEquipmentCommand,EquipmentModel>
    {
        private readonly IEquipmentRepository _equipmentRepository;

        public FillEquipmentCommandHandlers(IEquipmentRepository equipmentRepository)
        {
            _equipmentRepository = equipmentRepository;
        }

        public async Task<EquipmentModel> Handle(FillEquipmentCommand request, CancellationToken cancellationToken)
        {
           return await _equipmentRepository.GetModelAsync(request.EquipmentId);
        }
    }
}
